package org.liveboardgames.agricola.view.component
{
    import org.liveboardgames.agricola.vo.action.Action;
    import org.liveboardgames.common.dictionary.collections.IMap;
    
    public class PaymentImage extends SelectableImage
    {
        private var _cost:IMap;
        
        public function PaymentImage()
        {
            super();
            this.setStyle("horizontalCenter", "0");
            this.setStyle("verticalCenter", "0");
        }
        
        override public function set width(value:Number):void
        {
            super.width = value;
            super.height = value;
        }
        
        override public function set height(value:Number):void
        {
            super.width = value;
            super.height = value;
        }
        
        public function set cost(value:IMap):void
        {
            this._cost = value;
            updateSource();
        }
        
        public function get cost():IMap
        {
            return this._cost;
        }
        
        private function updateSource():void
        {
            if (cost != null)
            {
                this.source = getImage(cost);
                //this.toolTip = getToolTip(cost);
            }
        }
        
        private function getImage(cost:IMap):String
        {
            trace("Need to define one image per action that can be chosen");
            return ImageHandler.IMAGE_ROOT_PATH + "common/farm/field.png";
        }
    }
}